#ifndef __STRUCTURES_H_
#define __STRUCTURES_H_


struct gcolor_struct
{
    unsigned long color;
};

typedef struct gcolor_struct color_t;

/* File operations. Defined for every element */

struct gfile_ops {
    int (*open)(char * name);
    int (*close)(int fd);
    int (*hide)(int fd);
    int (*show)(int fd);
    int (*send)(int fd, int id);
    int (*receive)(int fd, int id);
    int (*write)(int fd, void * data, int size);
    int (*read)(int fd, void * data, int size);
};

typedef struct gfile_ops gfops_t;

/* Structures hierarchy (bottom first)
 * gatom -> gelement -> (gwindow / gbutton / gmenu / whatever you want )
 * gatom - minimal graphical block.
 * gelement - collection of gatoms, it structures them and link them together.
 * Moreover, the gelement receives signals, not gatom.
 * Upper level it it already complex structures, as menus, windows, sliders and so  * on */



/* gatom (grafical atom) is the minimal type of an element. It may be a line, a point, a
 * backgrount, an so on.
 * But what is the right way to descrive atom ?
 * I think it should be a action, and action related arguments.
 * For example:
 * for a line ir should be a begin, end and color + alpha.
 * for a point it should be the place and the color + alpha.
 * for rectangle it should be coordinates of left-up and right-down,  * color+alpha
 * So on.
 * The gatom knows nothing about it's Z. 
 * The Z value is the property of "upper" sturcture.
 */

struct gatom_structure
{
    struct gatom_structure * next;
    unsigned short t; /* The type of the gatom */
    color_t color;
    int xl, xr, yl, yr; /* coordinates of the atom */

};

typedef struct gatom_struct gatom_t;

/* Seva. Window consists of a misc. elements. 
 * This structure describes ones */
struct gelement_struct
{
    struct gelement_struct * next; 
    gatom_t * gatoms;
    gfops_t * fops;

};

typedef struct gelement_struct gelement_t;

struct display_structure 
{
    unsigned int w; /* width */
    unsigned int h; /* height */
    unsigned char orientation; /* Horizontal / Vertical */
    unsigned long blackpixel;
    unsigned long whitepixel;
    int depth;
    int ndepth;
};

typedef struct display_structure display_t;


#endif /*STRUCTURES_H_ */
